package com.david.IfaceAutoTest.controller;

import com.david.IfaceAutoTest.entity.InterfaceQuery;
import com.david.IfaceAutoTest.service.InterfaceQueryService;
import io.swagger.annotations.*;
import com.david.IfaceAutoTest.entity.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 接口interface_query参数 控制层
 *
 * @author david
 * @since 2021-12-24
 */
@RestController
@Api(tags = "interface_query接口")
@RequestMapping("/IfaceAutoTest/interface-query")
public class InterfaceQueryController {

    private final InterfaceQueryService interfacequeryservice;

    @Autowired
    public InterfaceQueryController(InterfaceQueryService interfacequeryservice) {
        this.interfacequeryservice = interfacequeryservice;
    }

    @GetMapping("/list")
    @ApiOperation(value = "接口interface_query参数列表查询", notes = "list")
    public CommonResult<Object> list() {
        return CommonResult.success(interfacequeryservice.list());
    }

    @GetMapping("/get")
    @ApiOperation(value = "接口interface_query参数详情查询", notes = "get")
    public CommonResult<Object> get(Integer id) {
        return CommonResult.success(interfacequeryservice.getById(id));
    }

    @PostMapping("/save")
    @ApiOperation(value = "接口interface_query参数保存", notes = "save")
    public CommonResult<Object> save(InterfaceQuery interfacequery) {
        return CommonResult.success(interfacequeryservice.save(interfacequery));
    }

    @DeleteMapping("/delete")
    @ApiOperation(value = "接口interface_query参数删除", notes = "delete")
    public CommonResult<Object> delete(Integer id) {
        interfacequeryservice.removeById(id);
        return CommonResult.success();
    }
}
